#include "src/emule/aich_hash.h"
#include <string.h>

jellyfish::emule::aich_hash::aich_hash()
{
	memset(buffer, 0, jellyfish::emule::aich_hash::hash_size);
}

jellyfish::emule::aich_hash::aich_hash( uint8* data )
{
	read(data);
}

jellyfish::emule::aich_hash::aich_hash( const aich_hash& k1 )
{ 
	if (this != &k1)
	{
		*this = k1; 
	}
}

jellyfish::emule::aich_hash& jellyfish::emule::aich_hash::operator=( const aich_hash& k1 )
{
	memcpy(buffer, k1.buffer, jellyfish::emule::aich_hash::hash_size);
	return *this;
}

void jellyfish::emule::aich_hash::read( const uint8* data )
{ 
	memcpy(buffer, data, jellyfish::emule::aich_hash::hash_size);
}

uint8* jellyfish::emule::aich_hash::get_raw_hash()
{ 
	return buffer; 
}

jellyfish::emule::aich_hash::~aich_hash()
{

}

// uint32 jellyfish::emule::aich_hash::DecodeBase32( const wxString &base32 )
// {
// 
// }

bool jellyfish::emule::operator==( const aich_hash& k1,const aich_hash& k2 )
{
	return memcmp(k1.buffer, k2.buffer, jellyfish::emule::aich_hash::hash_size) == 0;
}

bool jellyfish::emule::operator!=( const aich_hash& k1,const aich_hash& k2 )
{ 
	return !(k1 == k2); 
}
